package com.zoncont.estate.service.impl;


import com.zoncont.common.annotation.DataSource;
import com.zoncont.common.core.text.Convert;
import com.zoncont.common.enums.DataSourceType;
import com.zoncont.estate.domain.DevInfo;
import com.zoncont.estate.mapper.CompanyMapper;
import com.zoncont.estate.mapper.DevInfoMapper;
import com.zoncont.estate.service.IDevInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备 服务层实现
 * 
 * @author ruoyi
 * @date 2019-08-04
 */
@Service
public class DevInfoServiceImpl implements IDevInfoService
{
	@Autowired
	private DevInfoMapper devInfoMapper;

	@Autowired
	private CompanyMapper  companyMapper;

	/**
     * 查询设备信息
     * 
     * @param infoId 设备ID
     * @return 设备信息
     */
    @Override
	@DataSource(DataSourceType.SLAVE)
	public DevInfo selectDevInfoById(Integer infoId)
	{
	    return devInfoMapper.selectDevInfoById(infoId);
	}
	
	/**
     * 查询设备列表
     * 
     * @param devInfo 设备信息
     * @return 设备集合
     */
	@Override
	@DataSource(DataSourceType.SLAVE)
	public List<DevInfo> selectDevInfoList(DevInfo devInfo)
	{
		List<DevInfo> list= devInfoMapper.selectDevInfoList(devInfo);

		return  list;

	}
	
    /**
     * 新增设备
     * 
     * @param devInfo 设备信息
     * @return 结果
     */
	@Override
	@DataSource(DataSourceType.SLAVE)
	public int insertDevInfo(DevInfo devInfo)
	{
	    return devInfoMapper.insertDevInfo(devInfo);
	}
	
	/**
     * 修改设备
     * 
     * @param devInfo 设备信息
     * @return 结果
     */
	@Override
	@DataSource(DataSourceType.SLAVE)
	public int updateDevInfo(DevInfo devInfo)
	{
	    return devInfoMapper.updateDevInfo(devInfo);
	}

	/**
     * 删除设备对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	@DataSource(DataSourceType.SLAVE)
	public int deleteDevInfoByIds(String ids)
	{
		return devInfoMapper.deleteDevInfoByIds(Convert.toStrArray(ids));
	}
	
}
